<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <title>病历统计信息</title>
    <?php PrintPageHead(); ?>
    <link href="../resource/css/hermes.css" rel="stylesheet">
    <link href="../resource/js/calendar/calendar-blue.css" type="text/css" rel="stylesheet">
    <script src="../resource/js/calendar/calendar.js" type="text/javascript"></script>
    <script src="../resource/js/hermes.js"></script>
    <style type="text/css">
        .divleft{width: 15%; float: left; text-align:left; border-right: solid 1px #d5d5d5; margin-right: 2% }
        .divleft2{width: 70%; float: left; text-align:left; border-right: solid 1px #d5d5d5; margin-right: 2% }
        .divright{ width: 8%; float:right; text-align: right;}


    </style>
    <?php
    if (!array_key_exists("公众号ID",$_SESSION)) {
        header("Location:back.php");
    }
    $order = "";
    switch(intval($_GET['order'])){
        case 0:
            $order = 'order by t.id desc';
            break;
        case 1:
            $order = 'order by tnum desc';
            break;
        case 2:
            $order = 'order by t.浏览次数 desc';
            break;

    }
    if(intval($_GET['page'])){
        $page = intval($_GET['page']);
    }else{
        $page = 1;
    }
    $sql = "select t.id,t.title,t.浏览次数,count(s.tid) as tnum from `语音课程` t left join statistic s on t.id=s.tid and s.type=2  GROUP BY t.id ".$order;
    $res = pdo()->page($sql,$page,10,array('state'=>'back14tongjikecheng','order'=>intval($_GET['order'])));


    ?>
</head>
<body>


<div class="container-fluid">

    <?php include_once 'back_header.php'; ?>

    <div class="panel panel-primary">
        <div class="panel-heading text-center"><h3 class="panel-title">课程统计信息</h3></div>

        <ul class="nav nav-pills" style="margin:20px">
            <li role="presentation"    ><a href="../back.php?state=back14tongjibingli&order=0">病历统计信息</a></li>
            <li role="presentation" class="active" ><a href="../back.php?state=back14tongjikecheng&order=0">课程统计信息</a></li>
            <li role="presentation" ><a href="../back.php?state=back14tongjitingke">听课人数统计信息</a></li>
            <li role="presentation" style="float:right"  <?php if(intval($_GET['order'])==1): ?>  class="active" <?php  endIF;?> ><a href="../back.php?state=back14tongjikecheng&order=1">按人数排序</a></li>
            <li role="presentation" style="float:right" <?php if(intval($_GET['order'])==2): ?>  class="active" <?php  endIF;?>><a href="../back.php?state=back14tongjikecheng&order=2">按阅读量排序</a></li>
            <li role="presentation" style="float:right" <?php if(intval($_GET['order'])==0): ?>  class="active" <?php  endIF;?>><a href="../back.php?state=back14tongjikecheng&order=0">按序号排序</a></li>
        </ul>

        <div class="panel-body">
            <div class="panel-group"   id="accordion" role="tablist" aria-multiselectable="true">
                <div class="panel panel-default" >
                    <div class="panel-heading" style="background-color:#d5d5d5" >
                        <div class="row">
                            <div class="col-xs-4 text-justify" style="width:100%;">
                                <div class="divleft"><b  >序号</b></div>
                                <div class="divleft"><b  >课程名称</b></div>
                                <div class="divleft"><b  >阅读人数</b></div>
                                <div class="divleft"><b  >阅读量</b></div>

                            </div>
                        </div>
                    </div>
                </div>
                <div class="panel panel-default">
                    <?php foreach($res['result'] as $key=>$value):?>
                        <div class="panel-heading"  style=" <?php if($key%2==0){echo "background-color:#DFF0D8;";}else{ echo "border-top: solid 2px #ffffff;";}?>">
                            <div class="row">
                                <div class="col-xs-4 text-justify" style="width:100%;">
                                    <div class="divleft"><span><?= $value['id']?></span></div>
                                    <div class="divleft"><span><?= $value['title']?></span></div>
                                    <div class="divleft"><span><?= $value['tnum']?></span></div>
                                    <div class="divleft"><span><?= $value['浏览次数']?></span></div>


                                </div>
                            </div>
                        </div>
                    <?php endforeach; ?>

                </div>

            </div>
            <?=$res['show']?>
        </div>
    </div>

</div>

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="../resource/js/jquery-1.11.1.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="../resource/js/bootstrap.min.js"></script>

</body>
</html>